/*
 * Sesame Inc.
 * Copyright (c) 2009 All Rights Reserved.
 */
package com.sesame.daoimpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sesame.dao.ComplaintDAO;
import com.sesame.domain.Complaint;

/**
 * @author shubeta
 * 
 */
public class ComplaintDAOImpl extends SqlMapClientDaoSupport implements
        ComplaintDAO {

    public void addComplaint(Complaint complaint) {
        getSqlMapClientTemplate().insert("addComplaint", complaint);
    }

    public void deleteComplaintById(Integer id) {
        getSqlMapClientTemplate().delete("deleteComplaintById", id);
    }

    @SuppressWarnings("unchecked")
    public List<Complaint> getAllComplaint() {
        return (List<Complaint>) getSqlMapClientTemplate().queryForList(
                "getAllComplaint");
    }

    public Complaint getComplaintById(Integer id) {
        return (Complaint) getSqlMapClientTemplate().queryForObject(
                "getComplaintId", id);
    }

    public void updateComplaintNote(Complaint complaint) {
        getSqlMapClientTemplate().update("updateComplaintNote", complaint);
    }

    public void updateComplaintState(Complaint complaint) {
        getSqlMapClientTemplate().update("updateComplaintState", complaint);
    }

}